package com.example.neusoft.yuejian_12.Activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;

import com.example.neusoft.yuejian_12.Listener.UserHelpListener;
import com.example.neusoft.yuejian_12.Model.UserModel;
import com.example.neusoft.yuejian_12.R;

public class MyHelpActivity extends AppCompatActivity {
    private ImageButton myset_apphelp_back;
    private Button help_submit;
    private EditText help_edit;
    String content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_help);
        help_submit = (Button) findViewById(R.id.help_submit);
        help_edit = (EditText) findViewById(R.id.help_edit);
        myset_apphelp_back = (ImageButton) findViewById(R.id.myset_apphelp_back);
        myset_apphelp_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        help_submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                content = help_edit.getText().toString();
                if (content.equals("")) {
                    Toast.makeText(MyHelpActivity.this, "您输入的信息为空", Toast.LENGTH_LONG).show();
                } else {
                    UserModel model=new UserModel();
                    model.UserHelp(content,userHelpListener);
                }
            }
        });
    }

    UserHelpListener userHelpListener = new UserHelpListener() {
        @Override
        public void onResponse(Integer beanobject) {
            Toast.makeText(MyHelpActivity.this, "反馈成功", Toast.LENGTH_LONG).show();
        }

        @Override
        public void onFail(String msg) {

        }
    };
}